using System;
using System.Linq;
using System.Text;
using System.Transactions;
using System.Collections.Generic;
using Entity;
using Common.Background.Entity;
using Data;

namespace Common.Background.Data
{

    /// <summary>
    /// 
    /// </summary>
    public class WebDepartmentsRepository : BackgroundRepositoryBase, IWebDepartmentsRepository
    {

        #region 构造函数

        /// <summary>
        /// 为了兼容性 提供默认构造函数
        /// </summary>
        public WebDepartmentsRepository() { }

        #endregion

        #region IRepository<WebDepartments> 成员

        public void Update(WebDepartments entity)
        {
            base.UpdateEntity(entity);
        }

        public void Update(IList<WebDepartments> list)
        {
            base.UpdateEntity(list.Cast<EntityBase>().ToList());
        }

        public void Insert(WebDepartments entity)
        {
            base.InsertEntity(entity);
        }

        public void Insert(IList<WebDepartments> list)
        {
            base.InsertEntity(list.Cast<EntityBase>().ToList());
        }

        public WebDepartments InsertGetIDENTITY(WebDepartments entity)
        {
            base.InsertEntity(entity);
            return this.Find(entity.PrimaryKey);
        }

        public void Delete(WebDepartments entity)
        {
            base.DeleteEntity(entity);
        }

        public void Delete(IList<WebDepartments> list)
        {
            base.DeleteEntity(list.Cast<EntityBase>().ToList());
        }

        public IQueryable<WebDepartments> GetModel()
        {
            return base.GetEntities<WebDepartments>().Where(i => i.Status != (int)global::Entity.CommonEnums.Status.Deleted);
        }

        public WebDepartments Find(params object[] keyValues)
        {
            return base.GetEntity<WebDepartments>(keyValues);
        }

        #endregion
    }
}
